package org.tao.lightningmq.nameserver.enums;

/**
 * @Author lht
 * @date 2025/1/16 - 22:19
 * @description:
 */
public enum ReplicationModeEnum {

    MASTER_SLAVE("master_slave", "主从复制模式"),
    TRACE("trace", "链路复制模式");

    ReplicationModeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    final String code;
    final String desc;

    public static ReplicationModeEnum getEnumByCode(String code) {
        for (ReplicationModeEnum replicationModeEnum : ReplicationModeEnum.values()) {
            if (replicationModeEnum.getCode().equals(code)) {
                return replicationModeEnum;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
